package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import news.NewTi;
import news.people;

public class MysqlPeople extends BaseDao implements peopleDao {

	public Map<String, String> login(String name, String pwd) {
		Map<String, String> mp = new HashMap<String, String>();
		String sql = "select uname,upwd from news_users where uname=? and upwd =? ";
		Connection conn = super.getConn();
		PreparedStatement st = null;
		ResultSet rs = null;
		try {
			st = conn.prepareStatement(sql);
			st.setString(1, name);
			st.setString(2, pwd);
			rs = st.executeQuery();
			while (rs.next()) {
				people t = new people();
				t.setName(rs.getString("uname"));
				t.setName(rs.getString("upwd"));
				mp.put(name, pwd);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			super.close(conn, st, rs);
		}
		return mp;
	}

}
